﻿using System;
using System.IO;
using System.Security.Policy;

namespace IDEAMS.common
{
    public class FileManager
    {
        public FileManager()
        {
            Init();
        }

        private int Init()
        {
            int rn = 0;
            
            progRootDIR = Directory.GetCurrentDirectory();

            confRootDIR = string.Format("{0}\\{1}", progRootDIR, "conf"); // 配置文件目录
            dataRootDIR = string.Format("{0}\\{1}", progRootDIR, "data"); // 数据文件根目录

            logConfigFile = string.Format("{0}\\{1}", progRootDIR, "logConfig\\log4net.config"); //日志配置

            globalSettingFile = string.Format("{0}\\{1}", confRootDIR, "global_setting.xml"); //全局配置
            etalonCollectionFile = string.Format("{0}\\{1}", confRootDIR, "etalonCollection.xml"); // 标准具列表文件

            resourceRootDIR = string.Format("{0}\\{1}", progRootDIR, "resources"); //资源存储目录
            soundPath = string.Format("{0}\\{1}", resourceRootDIR, "sound"); //声音目录

            deviceInfoCollectionFile = string.Format("{0}\\{1}", dataRootDIR, "deviceInfoCollection.xml"); // 当前设备列表文件
            roasterRecordCollectionFile = string.Format("{0}\\{1}", dataRootDIR, "roasterRecordCollection.xml"); // 历史烤机记录

            deviceParamFile = string.Format("{0}\\{1}", dataRootDIR, "{0}\\deviceParam.xml");  // 设备信息文件
            resultFile = string.Format("{0}\\{1}", dataRootDIR, "{0}\\resultFile.xml");  // 测试结果文件
            waveLenFile = string.Format("{0}\\{1}", dataRootDIR, "{0}\\waveLen.txt");  // 连续烤机波长存储文件
            alarmInfoCollectionFile = string.Format("{0}\\{1}", dataRootDIR, "{0}\\alarmInfoCollection.xml"); // 报警记录
            spectrumPath = string.Format("{0}\\{1}", dataRootDIR, "{0}\\spectrum");  // 光谱文件夹
            spectrumFile = string.Format("{0}\\{1}", dataRootDIR, "{0}\\spectrum\\spectrum_{1}_{2}.bin"); // 光谱文件夹路径
            deviceInfoFile = string.Format("{0}\\{1}", dataRootDIR, "{0}\\deviceInfo.xml");  // 设备信息保存路径
            collectDataPath = string.Format("{0}\\{1}", dataRootDIR, "{0}\\wave");  // 采集数据文件夹
            collectDataFile = string.Format("{0}\\{1}", dataRootDIR, "{0}\\wave\\wave_{1}.xml"); // 采集波长保存路径
            comparePath = string.Format("{0}\\{1}", dataRootDIR, "{0}\\etalon");  // 采集数据文件夹
            compareFile = string.Format("{0}\\{1}", dataRootDIR, "{0}\\etalon\\etalon_{1}.xml"); // 采集波长保存路径
            deviceSettingFile = string.Format("{0}\\{1}", dataRootDIR, "{0}\\setting.xml");  // 设备检测配置文件
            printStatusFile = string.Format("{0}\\{1}", dataRootDIR, "{0}\\printStatus.xml");  // 是否在报告显示文件

            return rn;
        }

        // 根目录
        public string progRootDIR;
        // 配置根目录
        public string confRootDIR;
        // 数据根目录
        public string dataRootDIR;

        // 日志配置文件路径
        public string logConfigFile;

        //资源目录
        public string resourceRootDIR;
        // 报警声音文件目录
        public string soundPath;
        
        // 当前设备列表文件
        public string deviceInfoCollectionFile;
        // 历史烤机设备列表
        public string roasterRecordCollectionFile;

        // 全局配置文件
        public string globalSettingFile;
        // 标准具文件
        public string etalonCollectionFile;

        // 设备信息文件路径
        public string deviceParamFile;
        // 测试结果文件
        public string resultFile;
        // 连续烤机波长存储文件
        public string waveLenFile;
        /// <summary>
        /// 报警记录
        /// </summary>
        public string alarmInfoCollectionFile;
        /// <summary>
        /// 光谱保存文件夹
        /// </summary>
        public string spectrumPath;
        /// <summary>
        /// 光谱保存路径
        /// </summary>
        public string spectrumFile;
        /// <summary>
        /// 设备详细信息
        /// </summary>
        public string deviceInfoFile;
        /// <summary>
        /// 采集数据保存文件夹
        /// </summary>
        public string collectDataPath;
        /// <summary>
        /// 采集数据保存路径
        /// </summary>
        public string collectDataFile;
        /// <summary>
        /// 标准具检测数据文件夹
        /// </summary>
        public string comparePath;
        /// <summary>
        /// 标准具检测数据路径
        /// </summary>
        public string compareFile;
        /// <summary>
        /// 设备检测配置文件
        /// </summary>
        public string deviceSettingFile;
        /// <summary>
        /// 打印状态文件夹
        /// </summary>
        public string printStatusFile;
    }
}
